The double get_composite_drawable case can happen for pixmap targets too, so move...
authorAlexander Larsson <alexl@redhat.com>
Fri, 5 Dec 2008 20:42:22 +0000 (21:42 +0100)
committerAlexander Larsson <alex@localhost.localdomain>
Thu, 2 Apr 2009 08:14:07 +0000 (10:14 +0200)
gdk/gdkdraw.c
gdk/gdkwindow.c

index 7b3fb5a289905491134f14e9e52faad5a3043e50..8e8a3be87a9d8572b20843ef777a3e8510471d10 100644 (file)
@@ -623,7 +623,7 @@ gdk_draw_drawable (GdkDrawable *drawable,
                   gint         width,
                   gint         height)
 {
-  GdkDrawable *composite;
+  GdkDrawable *composite, *composite_impl;
   gint composite_x_offset = 0;
   gint composite_y_offset = 0;
 
@@ -652,10 +652,21 @@ gdk_draw_drawable (GdkDrawable *drawable,
                                                           &composite_x_offset,
                                                           &composite_y_offset);
 
+  /* The draw_drawable call below is will recurse into gdk_draw_drawable again,
+   * specifying the right impl for the destination. This means the composite
+   * we got here will be fed to get_composite_drawable again, which is a problem
+   * for window as that causes double the composite offset. Avoid this by passing
+   * in the impl directly.
+   */
+  if (GDK_IS_WINDOW (composite))
+    composite_impl = GDK_WINDOW_OBJECT (src)->impl;
+  else
+    composite_impl = composite;
+  
   /* TODO: For non-native windows this may copy stuff from other overlapping
      windows. We should clip that and clear that area in the destination instead. */
   
-  GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, composite,
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, composite_impl,
                                                     xsrc - composite_x_offset,
                                                     ysrc - composite_y_offset,
                                                     xdest, ydest,
index 4c01723a7658da30ec27ef3f44cbf8c73e1ac56a..ea5642fe82bd849786078c697952aa9ea125456a 100644 (file)
@@ -2764,13 +2764,6 @@ gdk_window_draw_drawable (GdkDrawable *drawable,
   if (GDK_WINDOW_DESTROYED (drawable))
     return;
 
-  /* By this time the src has been gotten via get_composite_drawable.
-     If it is a window this implies lots of stuff that we don't want
-     to do again in the call below. So, we use the impl as the source to
-     avoid this. */
-  if (GDK_IS_WINDOW (src))
-    src = GDK_WINDOW_OBJECT (src)->impl;
-  
   /* If we have a backing pixmap draw to that */
   if (private->paint_stack)
     {